import { BasicPageResult, BasicPageSearch } from "./basicType";

/**
 * 课程标签
 */
export type CourseTag = {
    id: number;
    refId?: number;
    type?: number;
    tagId?: string;
    tagName?: string;
}

/**
 * 课程
 */
export type CoursePageSearch = BasicPageSearch & {
    tagList: number[]; // 选择的标签
}

export type Course = {
    id: number;
    srcCourseId?: string;
    pic?: string; //封面
    name?: string;
    author?: string;
    duration?: number;
    onlineDate?: string;
    status?: number;
    tags?: CourseTag[];
}

export type CoursePageResult = BasicPageResult & {
    records: Course[];
}

export type CourseJson = {
    detail: string;
    progress: string; // 学习进度
}

/**
 * 课程进度
 */
export type CourseProgressReport = {
    srcCourseId: string; // 源课程id
    seq: string; // 章节id
    playSecond: number; // 已经播放的秒数，向上取整
}

export type CourseProgressQuery = {
    srcCourseId: string; // 源课程id
    seq?: string; // 章节id, 不传则查询课程所有章节的进度
}

export type CourseProgressResult = {
    result: CourseProgressInfo [];
}

export type CourseProgressInfo = {
    srcCourseId: string; // 源课程id
    seq: string; // 章节id
    second: number; // 已经播放的秒数
}

export type PlayAuthJson = {
    detail: string;
}

/**
 * 推荐课程
 */
export type RecCoursePageSearch = BasicPageSearch & {
    cate?: number; // 课程分类，1-入门课程；2-进阶课程；3-高级课程；4-实战课程
    rec: number; // 位置，10-专题页；11-精选首页
}

export type RecCourse = {    
    courseId?: number; //课程ID
    srcCourseId: string; // 源课程id
    name?: string;
    pic?: string; //封面
    progress?: string; //学习进度
    videoNum?: number; // 总视频数量
    curVideoNum?: number; // 当前已更新的视频数量
}

export type RecCoursePageResult = BasicPageResult & {
    records: RecCourse[];
}

/**
 * 热门课程
 */
export type HotCourseSearch = {
    size: number; // 获取数量
}

export type HotCourse = {    
    id?: number; //ID 编号
    srcCourseId: string; // 源课程id
    name?: string; // 名称
    pic?: string; //封面
    videoNum?: number; // 数量
    curVideoNum?: number; // 当前数量
    author?: string; // 作者
}

export type HotCourseResult = {
    courses: HotCourse[];
}

/**
 * 课程目录信息
 */
export type CourseCatalogItem = {
    seq: number;
    courseId: number;
    key: string;
    title: string;
    children?: CourseCatalogItem[];
    progressInfo?: string;
    progressClass?: string;
    source?: string;
    vid?: string;
    playauth?: string;
}
